<?php
declare (strict_types = 1);

namespace app\subscribe;

use app\model\ActivityComment;
use app\model\StoreAssess;
use app\model\StoreAssessComment;

class Store
{
    protected string $eventPrefix = 'Store';


    /**
     * 增加评论
     * @param $id
     * @return true
     */
    function onAssessIncComment($id)
    {
        $model = new StoreAssess();
        $model->where('id',$id)->inc('comment')->update();
        return true;
    }
	
	/**
	 * 增加浏览人数
	 * @param $id
	 * @return bool
	 */
	function onIncBrowse($id): bool
	{
		$model = new \app\model\Store();
		$model->where('id',$id)->inc('browse')->update();
		return true;
	}
	
	
	/**
     * 评论评论增加点赞
     * @param $id
     * @return true
     */
    function onAssessCommentIncLike($id)
    {
        $model = new StoreAssessComment();
        $model->where('id',$id)->inc('like')->update();
        return true;
    }

    /**
     * 评论评论减少点赞
     * @param $id
     * @return true
     */
    function onAssessCommentDecLike($id)
    {
        $model = new StoreAssessComment();
        $model->where('id',$id)->dec('like')->update();
        return true;
    }

    /**
     * 评价增加点赞
     * @param $id
     * @return true
     */
    function onAssessIncLike($id)
    {
        $model = new StoreAssess();
        $model->where('id',$id)->inc('like')->update();
        return true;
    }

    /**
     * 评价减少点赞
     * @param $id
     * @return true
     */
    function onAssessDecLike($id)
    {
        $model = new StoreAssess();
        $model->where('id',$id)->dec('like')->update();
        return true;
    }


    /**
     * 评价增加收藏
     * @param $id
     * @return true
     */
    function onAssessIncCollect($id): bool
    {
        $model = new StoreAssess();
        $model->where('id',$id)->inc('collect')->update();
        return true;
    }

    /**
     * 评价减少收藏
     * @param $id
     * @return true
     */
    function onAssessDecCollect($id): bool
    {
        $model = new StoreAssess();
        $model->where('id',$id)->dec('collect')->update();
        return true;
    }



}
